<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
<title></title>
<base href="<%=basePath%>">
<%@ include file="/base/jsp/include.jsp"%>
<script type="text/javascript">
    var grid;
    var addFun = function() {
        var dialog = parent.sy.modalDialog({
            title : '添加',
            width : 800,
            height : 600,
            url : sy.contextPath + '/go.do?path=abilityMsg/abilityEdit',
            buttons : [ {
                text : '添加',
                handler : function() {
                    dialog.find('iframe').get(0).contentWindow.submitForm(dialog, grid, parent.$);
                }
            } ]
        });
    };
    var editFun = function() {
        var rows = grid.datagrid('getSelections');
        if (rows.length != 1) {
            parent.$.messager.w('请选择一条记录进行编辑！');
            return;
        }
        /* if(rows[0].isAgree == 1 || rows[0].isAgree == 2){
            parent.$.messager.w('该记录已经被审核过了！');
            return;
        } */
        var dialog = parent.sy.modalDialog({
            title : '修改',
            width : 800,
            height : 600,
            url : sy.contextPath + '/go.do?path=abilityMsg/abilityEdit&id=' + rows[0].id,
            buttons : [ {
                text : '编辑',
                handler : function() {
                    dialog.find('iframe').get(0).contentWindow.submitForm(dialog, grid, parent.$);
                }
            } ]
        });
    };
    $(function() {
        
        var menu;
        menu={
                url : sy.contextPath + '/ability/myList.do',
                toolbar : '#toolbar',
                singleSelect : false,
                columns : [ [ {
                    width : $(this).width() * 0.06,
                    title : '标题',
                    field : 'title',
                    align : 'center'
                },{
					width : $(this).width() * 0.1,
					title : '项目领域',
					field : 'projectArea',
					align : 'center'
				},{
					width : $(this).width() * 0.1,
					title : '项目介绍',
					field : 'message',
					align : 'center',
				},{
					width : $(this).width() * 0.1,
					title : '人才简介',
					field : 'personMessage',
					align : 'center',
				},{
					width : $(this).width() * 0.08,
					title : '项目阶段',
					field : 'projectState',
					align : 'center',
				}, {
					width : $(this).width() * 0.1,
					title : '合作需求',
					field : 'teamWorkXq',
					align : 'center',
				}, {
					width : $(this).width()*0.05,
					title : '状态',
                    field : 'isAgree',
                    align : 'center',
                    formatter : function(value, row, index) {
                        if(value == 0){
                        	return  '<a href="javascript:void(0);"  style="color:red" title="未审核">未审核</a>';
                        }else if(value == 1){
                        	return  '<a href="javascript:void(0);"  ><img src="base/images/yes.png" title="审核通过" > </img></a>';
                        }else if(value == 2){
                        	return  '<a href="javascript:void(0);"  ><img src="base/images/no.png" title="审核不通过" > </img></a>';
                        }
                    }
				},
                ] ]
            };
        
        grid = $('#grid').datagrid(menu);
    });
    
    function SaveData(data) {
        var url = sy.contextPath + '/ability/update.do';
        $.post(url, data, function() {
            grid.datagrid('reload');
        }, 'json');
    }

    function checkContent(id){
        var url = sy.contextPath +'/go.do?path=abilityMsg/contentDetail&id=' + id;
        var dialog = parent.sy.modalDialog({
            title : '内容',
            width : 800,
            height : 620,
            url : url,
        });
    }
    
    function check(id){
    	var url = sy.contextPath + '/go.do?path=act/detail&id='+id;
    	var dialog = parent.sy.modalDialog({
            title : '详情',
            width : 800,
            height : 620,
            url : url,
        });
    }
</script>
</head>
<body class="easyui-layout" data-options="fit:true,border:false">
    <div id="toolbar" style="display: none;">
        <table>
            <tr>
                <td>
                    <table>
                        <tr>                          
                            <td><a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-note_add',plain:true" onclick="addFun();">添加</a></td>
                            <td><a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-table_edit',plain:true" onclick="editFun();">修改</a></td>
                            <td><div class="datagrid-btn-separator"></div></td>
                        </tr>
                    </table>
                </td>
            </tr>       
            <tr>
                <td>
                    <form id="searchForm">
                        <table>
                            <tr>
                                <td>标题：</td>
                                <td>
                                    <input type="text" class="easyui-textbox" name="name" style="width: 150px"  />
                                </td>
                                <td>
                                    <a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-zoom',plain:true" onclick="grid.datagrid('load',sy.serializeObject($('#searchForm')));">过滤</a>
                                    <a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-zoom_out',plain:true" onclick="$('#searchForm input').val('');grid.datagrid('load',{});">重置过滤</a>
                                </td>
                            </tr>
                        </table>
                    </form>
                </td>
            </tr>
        </table>
    </div>
    <div data-options="region:'center',fit:true,border:false">
        <table id="grid" data-options="fit:true,border:false"></table>
    </div>
</body>
</html>